set(libkconfiggui_SRCS
   kconfiggui.cpp
   kconfiggroupgui.cpp
   kconfigloader.cpp
   kconfigskeleton.cpp
   kstandardshortcut.cpp
   kwindowconfig.cpp
)
ecm_create_qm_loader(libkconfiggui_SRCS kconfig5_qt)

add_library(KF5ConfigGui ${libkconfiggui_SRCS})
add_library(KF5::ConfigGui ALIAS KF5ConfigGui)
ecm_generate_export_header(KF5ConfigGui
    BASE_NAME KConfigGui
    GROUP_BASE_NAME KF
    VERSION ${KF5_VERSION}
    DEPRECATED_BASE_VERSION 0
    DEPRECATION_VERSIONS 5.11 5.39 5.71
    EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT}
)

target_include_directories(KF5ConfigGui INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF5}/KConfigGui>")

target_link_libraries(KF5ConfigGui PUBLIC Qt5::Gui Qt5::Xml KF5::ConfigCore)

set_target_properties(KF5ConfigGui PROPERTIES VERSION   ${KCONFIG_VERSION_STRING}
                                              SOVERSION ${KCONFIG_SOVERSION}
                                              EXPORT_NAME ConfigGui
)

ecm_generate_headers(KConfigGui_HEADERS
  HEADER_NAMES
  KConfigGui
  KConfigLoader
  KConfigSkeleton
  KStandardShortcut
  KWindowConfig

   REQUIRED_HEADERS KConfigGui_HEADERS
)

find_package(PythonModuleGeneration)

if (PythonModuleGeneration_FOUND)
  ecm_generate_python_binding(
    TARGET KF5::ConfigGui
    PYTHONNAMESPACE PyKF5
    MODULENAME KConfigGui
    RULES_FILE "${CMAKE_SOURCE_DIR}/cmake/rules_PyKF5.py"
    SIP_INCLUDES
      "${CMAKE_BINARY_DIR}/src/core/sip"
    SIP_DEPENDS
      QtGui/QtGuimod.sip
      PyKF5/KConfigCore/KConfigCoremod.sip
    HEADERS
      kconfiggui.h
      kconfigloader.h
      kconfigskeleton.h
      kstandardshortcut.h
      kwindowconfig.h
  )
endif()

install(TARGETS KF5ConfigGui EXPORT KF5ConfigTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})

install(FILES
  ${CMAKE_CURRENT_BINARY_DIR}/kconfiggui_export.h
  ${KConfigGui_HEADERS}
  DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/KConfigGui COMPONENT Devel
)

# make available to ecm_add_qch in parent folder
set(KConfigGui_APIDOX_SRCS ${KConfigGui_HEADERS} PARENT_SCOPE)
set(KConfigGui_APIDOX_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)

include(ECMGeneratePriFile)
ecm_generate_pri_file(BASE_NAME KConfigGui LIB_NAME KF5ConfigGui DEPS "gui xml KConfigCore" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/KConfigGui)
install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
